<template>
  <view class="container">

    <!-- Content -->
    <view class="content">
      <!-- Shop Info -->
      <view class="shop-info">
        <text class="shop-name">Migou</text>
        <image class="shop-logo" src="/static/images/f.png" alt="Shop Logo" />
      </view>
	  
      <view class="reward">
        <text class="">积分奖励 20%</text>
      </view>
	  
	  <view class="title-price">
	    <text>金额</text>
	  </view>
	  
      <!-- Amount Input -->
      <view class="amount-section">
        <text class="currency">￥</text>
        <input class="amount-input" placeholder="请输入金额" type="number" />
      </view>
      <view class="divider"></view>

      <!-- Coupon Info -->
      <view class="coupon-info">
        <text class="no-coupon">暂不可使用抵用券</text>
      </view>

      <!-- Submit Button -->
      <button class="pay-button">去支付</button>

      <!-- Footer -->
      <view class="footer">
        <text class="switch-account">切换商家账号登录</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {};
  },
  methods:{
	GetwxUrlParam(url) {
	  let theRequest = {};
	  if(url.indexOf("#") != -1){
		  const str=url.split("#")[1];
		  const strs=str.split("&");
		  for (let i = 0; i < strs.length; i++) {
			theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
		  }
	  }else if(url.indexOf("?") != -1){
		  const str=url.split("?")[1];
		  const strs=str.split("&");
		  for (let i = 0; i < strs.length; i++) {
			theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
		  }
	  }
	  return theRequest;
	}
  },
  onLoad(option) {
	if(option.q && option.q != "undefined"){
		const url = decodeURIComponent(option.q);
		console.log(url, 'url')
		let jsonUrl = this.GetwxUrlParam(url)
		console.log("解析后的url", jsonUrl);  
	}
  }
};
</script>

<style scoped>
	.container {
	  padding: 20px;
	  background-color: #f9f9f9;
	  min-height: 100vh;
	  display: flex;
	  flex-direction: column;
	  align-items: center;
	}

	.header {
	  display: flex;
	  justify-content: space-between;
	  align-items: center;
	  width: 100%;
	  padding: 10px 0;
	  border-bottom: 1px solid #e0e0e0;
	}

	.header-left .back-icon {
	  font-size: 18px;
	}

	.title {
	  font-size: 18px;
	  font-weight: bold;
	}

	.header-right .rating {
	  font-size: 14px;
	  color: #666;
	}

	.content {
	  margin-top: 20px;
	  width: 100%;
	  max-width: 400px;
	  display: flex;
	  flex-direction: column;
	  align-items: center;
	}

	.shop-info {
	  display: flex;
	  align-items: center;
	  justify-content: space-between;
	  width: 100%;
	  /* padding: 10px 0; */
	  padding-top: 10px;
	}

	.shop-name {
	  font-size: 16px;
	  font-weight: bold;
	}

	.reward {
	  display: flex;
	  align-items: center;
	  justify-content: space-between;
	  width: 100%;
	  font-size: 10px;
	  padding-bottom: 10px;
	}

	.title-price{
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding-top: 10px;
		font-size: 15px;
	}
	.shop-logo {
	  width: 40px;
	  height: 40px;
	  border-radius: 20px;
	}

	.amount-section {
	  display: flex;
	  align-items: center;
	  justify-content: center;
	  margin: 20px 0;
	  position: relative;
	}

	.currency {
	  font-size: 35px;
	  font-weight: bold;
	  margin-right: 10px;
	  color: #333;
	}

	.amount-input {
	  font-size: 28px;
	  /* font-weight: bold; */
	  color: #333;
	  text-align: left;
	  border: none;
	  outline: none;
	  flex: 1;
	  width: 60%;
	  padding: 0;
	  background-color: transparent;
	  line-height: 40px;
	  height: 40px
	}

	.amount-input::placeholder {
	  color: #ccc;
	}

	.divider {
	  width: 100%;
	  height: 1px;
	  background-color: #e0e0e0;
	  margin-top: 10px;
	}

	.coupon-info {
	  margin-bottom: 20px;
	  font-size: 14px;
	  color: #ff6f00;
	  padding-top: 20px;
	}

	.pay-button {
	  width: 100%;
	  padding: 8px 0;
	  background-color: #007aff;
	  color: #fff;
	  border: none;
	  border-radius: 30px;
	  font-size: 18px;
	  text-align: center;
	  height: 40px;
	}

	.footer {
	  margin-top: 20px;
	  font-size: 14px;
	  color: #007aff;
	  text-align: center;
	}
</style>
